<?php defined('_JEXEC') or die('Restricted access'); ?>
<?php 
JHTML::_('behavior.tooltip'); 
//var_dump('form');
$editor =& JFactory::getEditor();
//jimport('joomla.filter.output');
//JOutputFilter::objectHTMLSafe($this->selection);
?>
<script language="javascript" type="text/javascript">
	function submitbutton(pressbutton) {
		var form = document.adminForm;
		if (pressbutton == 'cancel') {
			submitform( pressbutton );
			return;
		}

		// do field validation
		if (form.title.value == ""){
			alert( "<?php echo JText::_( 'Staff Selection item must have a title', true ); ?>" );
		} else if (form.catid.value == "0"){
			alert( "<?php echo JText::_( 'You must select a category', true ); ?>" );
		} else {
				<?php
				echo $editor->save( 'description' );
				?>
				submitform( pressbutton );
		}
	}
</script>
<style type="text/css">
	table.paramlist td.paramlist_key {
		width: 92px;
		text-align: left;
		height: 30px;
	}
</style>

<form action="index.php" method="post" name="adminForm">
<div class="col width-70">
	<fieldset class="adminform">
		<legend><?php echo JText::_( 'Details' ); ?></legend>

		<table class="admintable">
		<tr>
			<td width="100" align="right" class="key">
				<label for="title">
					<?php echo JText::_( 'Name' ); ?>:
				</label>
			</td>
			<td>
				<input class="text_area" type="text" name="title" id="title" size="32" maxlength="250" value="<?php echo $this->selection->title;?>" />
			</td>
		</tr>
		<tr>
			<td width="100" align="right" class="key">
				<label for="alias">
					<?php echo JText::_( 'Alias' ); ?>:
				</label>
			</td>
			<td>
				<input class="text_area" type="text" name="alias" id="alias" size="32" maxlength="250" value="<?php echo $this->selection->alias;?>" />
			</td>
		</tr>
		<tr>
			<td valign="top" align="right" class="key">
				<?php echo JText::_( 'Published' ); ?>:
			</td>
			<td>
				<?php echo $this->lists['published']; ?>
			</td>
		</tr>
		<tr>
			<td valign="top" align="right" class="key">
				<label for="catid">
					<?php echo JText::_( 'Category' ); ?>:
				</label>
			</td>
			<td>
				<?php echo $this->lists['catid']; ?>
			</td>
		</tr>
		<tr>
			<td valign="top" align="right" class="key">
				<label for="ordering">
					<?php echo JText::_( 'Ordering' ); ?>:
				</label>
			</td>
			<td>
				<?php echo $this->lists['ordering']; ?>
			</td>
		</tr>
	</table>
	</fieldset>

	<fieldset class="adminform">
				<legend><?php echo JText::_( 'Description' ); ?></legend>

				<table class="admintable" width="100%">
					<tr>
						<td valign="top" colspan="5">
							<?php
							// parameters : areaname, content, width, height, cols, rows, show xtd buttons
							echo $editor->display( 'description',  $this->selection->description, '100%', '200', '75', '20', false) ;
							?>
						</td>
					</tr>
					</table>
			</fieldset>
</div>

<div class="col width-30" style="float:right; clear:none">
	<fieldset class="adminform">
		<legend><?php echo JText::_( 'Staff Selection Parameters' ); ?></legend>

		<table class="admintable">
		<tr>
			<td valign="top" width="320" style="padding: 7px 0 0 5px">
			<?php
				jimport('joomla.html.pane');
				//jimport('joomla.filter.output');
				//JOutputFilter::objectHTMLSafe( $row );
				
				JHTML::_('behavior.calendar');
				$db		=& JFactory::getDBO();
				
				//$editor =& JFactory::getEditor();
				$pane	=& JPane::getInstance('sliders');
				$form = new JParameter( '', JPATH_ADMINISTRATOR .'/components/com_bookstore/models/selection.xml');
				//get time
				/*
				$this->selection->params =  $this->selection->params."\ntime=".$this->selection->reg->getValue('hour').":".$this->selection->reg->getValue('minute').":".$this->selection->reg->getValue('second');
				*/
				$form->loadINI($this->selection->params);
				//if(empty($this->selection->publish_up){
					//$form->set('start_date', JHTML::_('date', $this->selection->start_date, '%Y-%m-%d'));
				//$form->set('publish_up', $this->selection->start_date." ".$this->selection->start_time);
				$form->set('keywords', $this->selection->keywords);
				$form->set('author', $this->selection->author);
					//$form->set('hour', $this->time_selector_obj->hours);
				//}
				
				/*
				ContentView::_displayArticleStats($row, $lists);
				*/
				
				$title = JText::_( 'Staff Selection Parameters' );
				echo $pane->startPane("content-pane");
				echo $pane->startPanel( $title, "detail-page" );
				echo $form->render();
				/**/
			// commented out advanced params; start and end publish aren't being used	
			//	$title = JText::_( 'Advanced Parameters' );
			//	echo $pane->endPanel();
			//	echo $pane->startPanel( $title, "params-page" );
			//	echo $form->render('params', 'advanced');
				/**/
				
				$title = JText::_( 'Metadata Information' );
				echo $pane->endPanel();
				echo $pane->startPanel( $title, "metadata-page" );
				echo $form->render('meta', 'metadata');
				
				
				echo $pane->endPanel();
				echo $pane->endPane();
				/**/
			?>
			</td>
		</tr>
		</table>
	</fieldset>
</div>

<div class="clr"></div>
<input type="hidden" name="option" value="com_bookstore" />
<input type="hidden" name="controller" value="staff" />
<input type="hidden" name="id" value="<?php echo $this->selection->id; ?>" />
<input type="hidden" name="created" value="<?php echo $this->selection->created?>" />
<input type="hidden" name="task" value="" />

</form>
